<template>
<el-dialog title="档案借出" :visible.sync="visible" width="500px" append-to-body :close-on-click-modal="false">
  <p>请确认以下档案借出信息</p>
  <el-descriptions :column="1" size="small" border>
    <el-descriptions-item label="案卷号">{{ borrowData.fileCode }}</el-descriptions-item>
    <el-descriptions-item label="题名">{{ borrowData.title }}</el-descriptions-item>
    <el-descriptions-item label="借出人">{{ borrowData.userName }}</el-descriptions-item>
    <el-descriptions-item label="经办人">{{ currUserName }}</el-descriptions-item>
  </el-descriptions>
  <div slot="footer" class="dialog-footer">
    <el-button type="primary" @click="submit">确认借出</el-button>
    <el-button @click="cancel">取 消</el-button>
  </div>
</el-dialog>
</template>

<script>
import {borrowAmDescription} from "@/api/am/amBorrow";
export default {
  data() {
    return {
      visible: false,
      rules: {},
      borrowData: {}
    }
  },
  computed: {
    currUserName() {
      return this.$store.getters.name
    }
  },
  methods: {
    open(borrowData) {
      this.borrowData = borrowData
      this.visible = true
    },
    submit() {
      borrowAmDescription(this.borrowData.id).then(response => {
        this.$modal.msgSuccess('档案借出成功');
        this.$emit('success');
        this.cancel();
      })
    },
    cancel() {
      this.visible = false
    },
  }
}
</script>

<style lang="scss"></style>
